﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace FetionLite
{
    public enum LoginState
    {
        FX_LOGIN_CONNECTING = FxEvent.FX_EVENT_BASE + 0x0001, //连接服务器
        FX_LOGIN_WAIT_AUTH = FxEvent.FX_EVENT_BASE + 0x0002, //等待认证
        FX_LOGIN_AUTH_OK = FxEvent.FX_EVENT_BASE + 0x0003, //认证成功
        FX_LOGIN_FAIL = FxEvent.FX_EVENT_BASE + 0x0004, //登陆失败
        FX_LOGIN_NETWORK_ERROR = FxEvent.FX_EVENT_BASE + 0x0005, //网络错误
        FX_LOGIN_UNKOWN_ERROR = FxEvent.FX_EVENT_BASE + 0x0006, //未知错误
        FX_LOGIN_UNKOWN_USR = FxEvent.FX_EVENT_BASE + 0x0007, //用户不存在
        FX_LOGIN_GCL_GETTING = FxEvent.FX_EVENT_BASE + 0x0008, //正在获取联系人列表
        FX_LOGIN_GCL_OK = FxEvent.FX_EVENT_BASE + 0x0009,//获取联系人列表成功
        FX_LOGIN_GCL_FAIL = FxEvent.FX_EVENT_BASE + 0x000A, //获取联系人列表失败
        FX_LOGIN_GP_GETTING = FxEvent.FX_EVENT_BASE + 0x000B,//正在获取联系人状态
        FX_LOGIN_GP_OK = FxEvent.FX_EVENT_BASE + 0x000C,//获取联系人状态成功
        FX_LOGIN_GP_FAIL = FxEvent.FX_EVENT_BASE + 0x000D, //获取联系人状态失败
        FX_LOGIN_OK = FxEvent.FX_EVENT_BASE + 0x000E, //登陆成功
        FX_LOGIN_TIMEOUT = FxEvent.FX_EVENT_BASE + 0x000F, //登陆超时 ? need it.. have a UNKOWN_ERROR
        FX_LOGIN_URI_ERROR = FxEvent.FX_EVENT_SPARE + 0x0001, //login fail of get the user's uri fail
        FX_LOGIN_SERVER_ERROR = FxEvent.FX_EVENT_SPARE + 0x0002, //
        FX_LOGIN_SERVER_REFUSE = FxEvent.FX_EVENT_SPARE + 0x0003, //fetion server refuse, you should relogin again
        FX_LOGIN_GSML_OK = FxEvent.FX_EVENT_SPARE + 0x0004, //get schedule sms list ok
        FX_LOGIN_GSML_FAIL = FxEvent.FX_EVENT_SPARE + 0x0005 //get schedule sms list fail
    }

    public enum FxSysMessage
    {
        FX_NEW_MESSAGE = FxEvent.FX_EVENT_BASE + 0x0010,
        FX_ACCOUNT_UPDATA_OK = FxEvent.FX_EVENT_BASE + 0x0050,
    }

    public enum FetionUserType
    {
        FTION_UTYPE_UNSET = 0,        //未设置 
        FTION_UTYPE_PC,               //PC用户，已经注册fetion 
        FTION_UTYPE_MOBLIE            //手机用户，未注册fetion 
    }

    public enum FetionUserStatus
    {
        FX_STATUS_UNSET = FxEvent.FX_EVENT_BASE + 0x0040,   //未设置
        FX_STATUS_ONLINE = FxEvent.FX_EVENT_BASE + 0x0042,   //在线
        FX_STATUS_BUSY = FxEvent.FX_EVENT_BASE + 0x0043,   //忙碌
        FX_STATUS_OFFLINE = FxEvent.FX_EVENT_BASE + 0x0044,    //隐身  
        FX_STATUS_AWAY = FxEvent.FX_EVENT_BASE + 0x0045,   //马上回来
        FX_STATUS_MEETING = FxEvent.FX_EVENT_BASE + 0x0046,   //会议中
        FX_STATUS_PHONE = FxEvent.FX_EVENT_BASE + 0x0047,   //电话中
        FX_STATUS_DINNER = FxEvent.FX_EVENT_BASE + 0x0048,   //外出用餐
        FX_STATUS_EXTENDED_AWAY = FxEvent.FX_EVENT_BASE + 0x0049,   //离开 
        FX_STATUS_NUM_PRIMITIVES = FxEvent.FX_EVENT_BASE + 0x004A,   //自定义
        FX_STATUS_WAITING_AUTH = FxEvent.FX_EVENT_BASE + 0x004B,
        FX_STATUS_REFUSE = FxEvent.FX_EVENT_BASE + 0x004C,
        FX_STATUS_BLACK = FxEvent.FX_EVENT_BASE + 0x004D,
        FX_STATUS_MOBILE = FxEvent.FX_EVENT_BASE + 0x004E,
        FX_STATUS_SMSEXTENED = FxEvent.FX_EVENT_BASE + 0x004F
    }

    public class FetionGroup
    {
        public int Id
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }
    }

    public class FetionPersonal
    {
        /// <summary>
        /// 昵称
        /// </summary>
        public string NickName { get; set; }
        /// <summary>
        /// 心情
        /// </summary>
        public string Impresa { get; set; }
        /// <summary>
        /// 性别 1 boy 0 girl
        /// </summary>
        public int Gender { get; set; }
        /// <summary>
        /// 国家
        /// </summary>
        public string Nation { get; set; }
        /// <summary>
        /// 州
        /// </summary>
        public string Province { get; set; }
        /// <summary>
        /// 城市编号，需要测试
        /// </summary>
        public int City { get; set; }
        public int IvrEnabled { get; set; }
        public int PortraitCRC { get; set; }
        public int Provisoning { get; set; }
        /// <summary>
        /// 手机号码
        /// </summary>
        public string MobileNo { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 生日
        /// </summary>
        public string Birthday { get; set; }
        /// <summary>
        /// 生日是否有效？？
        /// </summary>
        public int BirthdayValid { get; set; }
        /// <summary>
        /// 农历生肖
        /// </summary>
        public int LunarAnimal { get; set; }
        public int Horoscope { get; set; }
        public string Profile { get; set; }
        public int BloodType { get; set; }
        public string Occupation { get; set; }
        public string Hobby { get; set; }
        public string PersonalEmail { get; set; }
        public string WorkEmail { get; set; }
        public string OtherEmail { get; set; }
        public int PrimaryEmail { get; set; }
        public string JobTitle { get; set; }
        public string HomePhone { get; set; }
        public string WorkPhone { get; set; }
        public string OtherPhone { get; set; }
        public string Company { get; set; }
        public string CompanyWebSite { get; set; }
        public int MatchEnabled { get; set; }
        public int RefuseSMSDay { get; set; }
    }

    public class FetionAccount
    {
        public int Id { get; set; }

        public string Uri { get; set; }

        public string LocalName { get; set; }

        public string BuddyLists { get; set; }

        public int GroupId { get; set; }

        public int RelationStatus { get; set; }

        public int OnlineNotify { get; set; }

        public int StatusCode { get; set; }

        public FetionUserStatus OnlineStatus { get; set; }

        public int PortraitCRC { get; set; }

        public FetionPersonal Personal { get; set; }

        public FetionUserType UserType { get; set; }

        public string DeviceType { get; set; }

        //additional properties out of libfetion Fetion_Account struct
        public string ShowName { get; set; }
        public string OnlineStatusText
        {
            get
            {
                string statusText;

                switch (this.OnlineStatus)
                {
                    case FetionUserStatus.FX_STATUS_UNSET:
                        statusText = "未设置";
                        break;
                    case FetionUserStatus.FX_STATUS_ONLINE:
                        statusText = "在线";
                        break;
                    case FetionUserStatus.FX_STATUS_BUSY:
                        statusText = "忙碌";
                        break;
                    case FetionUserStatus.FX_STATUS_OFFLINE :
                        statusText = "离线"; //隐身歧义太大
                        break;
                    case FetionUserStatus.FX_STATUS_AWAY:
                        statusText = "马上回来";
                        break;
                    case FetionUserStatus.FX_STATUS_MEETING:
                        statusText = "会议中";
                        break;
                    case FetionUserStatus.FX_STATUS_PHONE:
                        statusText = "电话中";
                        break;
                    case FetionUserStatus.FX_STATUS_DINNER:
                        statusText = "外出用餐";
                        break;
                    case FetionUserStatus.FX_STATUS_EXTENDED_AWAY:
                        statusText = "离开";
                        break;   
                    case FetionUserStatus.FX_STATUS_NUM_PRIMITIVES:
                        statusText = "自定义";
                        break;
                    case FetionUserStatus.FX_STATUS_WAITING_AUTH:
                        statusText = "等待验证";
                        break;
                    case FetionUserStatus.FX_STATUS_REFUSE:
                        statusText = "拒绝";
                        break;
                    case FetionUserStatus.FX_STATUS_BLACK:
                        statusText = "黑名单";
                        break;
                    case FetionUserStatus.FX_STATUS_MOBILE:
                        statusText = "短信在线";
                        break;
                    case FetionUserStatus.FX_STATUS_SMSEXTENED:
                        statusText = "SMS Extend Changed";
                        break;
                    default:
                        statusText = "未设置";
                        break;
                }

                return statusText;
            }
        }
    }

    public class FetionMsg
    {
        public int AccountId { get; set; }
        public string Message { get; set; }
        public string PlainMessage { get; set; }
        public string MessageFormat { get; set; }
        public string MessageTime { get; set; }
        public int QunId { get; set; }
    }
}
